import React, { useState, useRef } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table';
import { Button, message, Modal } from 'antd';
import { queryrefund } from '@/services/ant-design-pro/apis';

const BizType = (props) => {
  const actionRef = useRef();
  const [selRows, setSelRows] = useState();
  const [createModalVisible, handleModalVisible] = useState(false);
  const [updateModalVisible, handleUpdteModalVisible] = useState(false);
  const [stepFormVals, setStepFormVals] = useState();
  const [exportModalVisible, handleExportModalVisible] = useState(false);
  const param = {};

  const columns = [
    {
      title: 'id',
      dataIndex: 'id',
      hideInSearch: true,
    },
    {
      title: '退款单号',
      dataIndex: 'refundNo',
    },
    {
      title: '订单编号',
      dataIndex: 'tradeNo',
    },
    {
      title: '退款金额',
      dataIndex: 'refundAmount',
      hideInSearch: true,
    },
    {
      title: '支付金额',
      dataIndex: 'total',
      hideInSearch: true,
    },
    {
      title: '创建时间',
      dataIndex: 'creationTime',
      valueType: 'dateTime',
      hideInSearch: true,
    },
    {
      title: '查询时间',
      dataIndex: 'queryTime',
      valueType: 'dateRange',
      hideInTable: true, //在 Table 中不展示此列
    },
    {
      title: '订单状态',
      dataIndex: 'status',
      valueEnum: {
        PENDING: {
          text: '待处理',
          status: 'PENDING ',
        },
        IN_HAND: {
          text: '处理中',
          status: 'IN_HAND',
        },
        PROCESSED: {
          text: '已处理',
          status: 'PROCESSED',
        },
      },
    },
  ];

  return (
    <PageContainer>
      <ProTable
        columns={columns}
        actionRef={actionRef}
        params={param}
        headerTitle="退款单列表"
        rowKey="id"
        request={queryrefund}
        rowSelection={{
          onChange: (_, selRows) => {
            setSelRows(selRows);
          },
        }}
        search={{
          defaultCollapsed: false,
        }}
      ></ProTable>
    </PageContainer>
  );
};

export default BizType;
